<?php 
      echo $this->Html->css("chosen");
      echo $this->Html->css("dataTables");
 ?>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/customInput.jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/chosen.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/zice.custom1.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/ColVis.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/accounting.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/layout_table.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.autotab.js"></script>
<br>
<div style="float: left; width: 100%;">
<?php if(isset($attendanceEmployee)) {?>
	<form id="validation">
	<h3 style="text-align: center;">Bảng tính công tài xế, lơ xe tháng <?php $today = getdate(); echo $today['mon'];?></h3>
		<div class="tableName">
			<table class="display data_table2">
				<thead>
					<tr>
						<th><div class="th_wrapp">Tên nhân viên</div></th>
						<th><div class="th_wrapp">Loại nhân viên</div></th>
						<th><div class="th_wrapp">Số chuyến giao hàng</div></th>
					</tr>
				</thead>
				<tbody>
				<?php foreach ($attendanceEmployee as $item) {?>
				<tr class="odd gradeX editC" >
					<td><?php  echo $item['e']['name'];?></td>
					<td><?php  if($item['e']['employee_type_id'] == 3) echo 'Tài xế'; else echo 'Lơ xe';?></td>
					<td><?php  echo $item['0']['total'];?></td>
	      		</tr>	
	      		<?php }?>	
				</tbody>
			</table>
	    </div>
	</form>
	</div>
<?php } else {?>
<div class="onecolumn">
	<div class="clear"></div>
	<div class="content">
		<form id="formSearch" method="post" action="">
			<div class="section" style="float:left; width: 40%; border-bottom: none;">
				<label>
				Chọn nhân viên:
				
				</label>
				<div id="search_vendor">
					 <select data-placeholder="Chọn nhân viên..." class="chzn-select choose_employee" tabindex="2" name="choose_employee">
                          <option value=""></option> 
                          <?php foreach ($employee as $item) {?>
							<option value="<?php echo $item['e']['id']; ?>"><?php echo $item['e']['name'];}?></option>
                     </select>				
				</div>
			</div>
            <div class="section" style="float:left; width: 30%;border-bottom: none;">
                <label>Chọn tháng: </label>   
                <div><?php echo $this->Form->month('mouth', null, array('monthNames' => false, 'class' => 'chzn-select', 'name' => 'month')); ?></div>
            </div>
            <input type="hidden"  id="isSearch" class="isSearch" name="isSearch" value="1"/> 
            <div class="buttonAttendance" style="text-align: center;">
				<button class="uibutton" id='attendance' type='submit'><span class="ico gray checkmark2"></span>Chấm công</button>
			</div>
		</form>
	</div>
</div>
<?php } ?>

<?php if ($isSearch){?>
<div class="onecolumn">
	<div class="header">
	<span>
		<span class="ico gray spreadsheet"></span>
		Bảng tính công nhân viên
	</span>
	</div>
	<div class="clear"></div>
	<div class="content">
		<form>
			<div class="tableName">
				<table class="display data_table2 listWhInvoice" >
					<thead>
						<tr>
							<th><div class="th_wrapp">Tên nhân viên</div></th>
							<th><div class="th_wrapp">Thời gian đăng nhập</div></th>
							<th><div class="th_wrapp">Thời gian đăng xuất</div></th>
						</tr>
					</thead>
					<tbody>
					<?php 
						foreach ($list_attendance as $item) {
					?>
							<tr class="odd gradeX WhInvoice" id="<?php  echo $item['a']['id']; ?>">
		      					<td><?php  echo $item['e']['name'];?></td>
		      					<td><?php  echo date('d/m/Y H:i',strtotime($item['a']['login'])); ?></td>
		      					<td><?php  echo date('d/m/Y H:i',strtotime($item['a']['logout']));?></td>
		      					</tr><?php }?>
	     					
					</tbody>
				</table>
	            </div>
		</form>
	</div>
</div>
<?php }?>